﻿using System;
using System.Globalization;
using System.Windows.Data;
using System.Windows.Media;

namespace JY.Wpf.TestForMetro.Converters
{
    public class BackgroundConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            SolidColorBrush solidColorBrush = new SolidColorBrush(Colors.CadetBlue);
            if (value != null)
            {
                int status = int.Parse(value.ToString());
                switch (status)
                {
                    case 1:
                        solidColorBrush = new SolidColorBrush(Colors.ForestGreen);
                        break;
                    case 2:
                        solidColorBrush = new SolidColorBrush(Colors.Red);
                        break;
                }
            }

            return solidColorBrush;
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
